<!--滑行按钮-->
<template>
  <div>
    <button class="button" data-text="Awesome" :style="getStyle">
      <span class="actual-text">&nbsp;{{ text }}&nbsp;&nbsp;</span>
      <span aria-hidden="true" class="hover-text">&nbsp;{{ text }}&nbsp;</span>
    </button>
  </div>
</template>
<script setup lang="ts">
const props = defineProps({
  text: {
    default: "button" as string,
  },
});

const getStyle = () => {
  return {
    textTransform: props.text,
  }
}
</script>
<style scoped lang="less">
/* === removing default button style ===*/
.button {
  margin: 0;
  height: auto;
  background: transparent;
  padding: 0;
  border: none;
  cursor: pointer;
}

/* button styling */
.button {
  --border-right: 6px;
  --text-stroke-color: rgba(255, 255, 255, 0.6);
  --animation-color: #37ff8b;
  --fs-size: 2em;
  letter-spacing: 3px;
  text-decoration: none;
  font-size: var(--fs-size);
  font-family: "Arial";
  position: relative;
  color: transparent;
  -webkit-text-stroke: 1px var(--text-stroke-color);
}

/* this is the text, when you hover on button */
.hover-text {
  position: absolute;
  box-sizing: border-box;
  content: attr(data-text);
  color: var(--animation-color);
  width: 0%;
  inset: 0;
  border-right: var(--border-right) solid var(--animation-color);
  overflow: hidden;
  transition: 0.5s;
  -webkit-text-stroke: 1px var(--animation-color);
}

/* hover */
.button:hover .hover-text {
  width: 100%;
  filter: drop-shadow(0 0 23px var(--animation-color));
}
</style>